package com.project.bean;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 主贴实体类
 */
public class PostBean {
    private int id;
    private String name;
    private String content;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime date = LocalDateTime.now();
    /** 频道对象 */
    private ChannelBean channel;
    /** 用户对象 */
    private String user;
    /** 回帖集合 */
    private List<ReplyBean> replyList;
    /** 回帖数量 */
    private int replyNum;

    public PostBean() {
    }

    public PostBean(String name, String content,String user, LocalDateTime date, int channelId) {
        this.name = name;
        this.content = content;
        this.user = user;
        this.date = date;
        this.channel = new ChannelBean();
        this.channel.setId(channelId);
    }

    public PostBean( String name, String content, Integer channelId, String user) {
        this.name = name;
        this.content = content;
        this.channel = new ChannelBean();
        this.channel.setId(channelId);
        this.user = user;
    }



    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public LocalDateTime getDate() {
        return date;
    }

    public void setDate(LocalDateTime date) {
        this.date = date;
    }

    public ChannelBean getChannel() {
        return channel;
    }

    public void setChannel(ChannelBean channel) {
        this.channel = channel;
    }

    public String getUser() {
        return user;
    }

    public void setUser(String user) {
        this.user = user;
    }

    public List<ReplyBean> getReplyList() {
        return replyList;
    }

    public void setReplyList(List<ReplyBean> replyList) {
        this.replyList = replyList;
    }

    public int getReplyNum() {
        return replyNum;
    }

    public void setReplyNum(int replyNum) {
        this.replyNum = replyNum;
    }

    @Override
    public String toString() {
        return "PostBean{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", content='" + content + '\'' +
                ", date=" + date +
                ", channel=" + channel +
                ", user='" + user + '\'' +
                ", replyList=" + replyList +
                ", replyNum=" + replyNum +
                "}\n";
    }
}
